# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        黄周云  
# Name:         test02
# Description: 例13.3
# Author:       ASUS
# Date:         2019/4/13
#-------------------------------------------------------------------------------


import os
f = open('./files/urls.txt','r+')
url = ''
while True:
    url = f.readline()
    #将最后的行结束符
    url = url.rstrip()
    if url == '':
        break;
    else:
        print(url)
print('------------------------')
f.seek(0)
print(f.readlines())
#向文件中添加一个新行
f.write('http://jiketiku.com\n')
f.close()

f = open('./files/urls.txt','a+')
urlList = ['https://geekori.com\n','https://www.google.com\n']
f.writelines(urlList)
f.close()



